import request from "@/request";

// 获取oss上传凭证
export function getOssToken() {
  return request({
    url: "/oss/sign",
    method: "post",
  });
}

export const taskInfo = (identifier) => {
  return request({
    url: `/v1/minio/tasks/${identifier}`,
    method: "get",
  });
};

export const initTask = ({ identifier, fileName, totalSize, chunkSize }) => {
  return request({
    url: "/v1/minio/tasks",
    method: "post",
    data: { identifier, fileName, totalSize, chunkSize },
  });
};

export const preSignUrl = ({ identifier, partNumber }) => {
  return request({
    url: `/v1/minio/tasks/${identifier}/${partNumber}`,
    method: "get",
  });
};

export const merge = (identifier) => {
  return request({
    url: `/v1/minio/tasks/merge/${identifier}`,
    method: "post",
  });
};
